package com.mashibing.controller;

import com.mashibing.internalcommon.dto.ResponseResult;
import com.mashibing.requset.CheckVerificationCodeDTO;
import com.mashibing.service.VerificationCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/verificationCode")
public class verificationCodeController {

    @Autowired
    private VerificationCodeService verificationCodeService;

    @PostMapping("/generatorCode")
    public ResponseResult generatorCode(@Validated @RequestBody CheckVerificationCodeDTO verificationCodeDTO) {
        return verificationCodeService.generatorCode(verificationCodeDTO);
    }

    @PostMapping("/checkVerificationCode")
    public ResponseResult checkVerificationCode(@Validated @RequestBody CheckVerificationCodeDTO verificationCodeDTO) {
        return verificationCodeService.checkVerificationCode(verificationCodeDTO);
    }

}
